import request from "@/utils/request";
import { GEN_SERVER } from "@/config/baseUrl";

// 查询指标配置列表
export function getIndexConfigList(data) {
  return request({
    url: GEN_SERVER["index-server"] + "/def/indexConfig/list",
    method: "post",
    data: data,
  });
}

// 新增/修改指标配置
export function saveIndexConfig(data) {
  return request({
    url: GEN_SERVER["index-server"] + "/def/indexConfig/addOrUpdate",
    method: "post",
    data: data,
  });
}

// 禁用指标配置
export function disabledIndexConfig(params) {
  return request({
    url: GEN_SERVER["index-server"] + "/def/indexConfig/disableOrEnable",
    method: "post",
    params,
  });
}

// 查询指标配置详情
export function getIndexConfigDetail(id) {
  return request({
    url: GEN_SERVER["index-server"] + "/def/indexConfig/detail",
    method: "get",
    params: { id },
  });
}

// 根据元指标id查询指标配置自动编码
export function getIndexConfigCode(metaIndexId) {
  return request({
    url:
      GEN_SERVER["index-server"] +
      "/def/indexConfig/getIndexConfigCodeByMetaIndexId",
    method: "get",
    params: { metaIndexId },
  });
}
